<%@ page isELIgnored="false" %>
<%@ include file="/common/taglibs.jsp"%>
<%@ taglib uri="http://java.fckeditor.net" prefix="FCK" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Pragma" content="no-cache">
<link href="../style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="<c:url value='/admin/assets/js/jquery/jquery.js'/>"></script>
<script type="text/javascript" src="<c:url value='/admin/assets/js/util.js'/>"></script>
<script language="javascript">
function check(){
	var title = document.getElementById("title");
	if(title.value.trim()==""){
		OS.showWarming("errorTd","请输入讯息标题！");
		title.focus();
		return false;
	}else{OS.hideWarming("errorTd");}
	if($("#type option:selected").val() == -1){
		 OS.showWarming("errorTd","请选择讯息类别！");
		 $("#articleType").focus();
		 return false;
	}else {OS.hideWarming("errorTd");}
	<c:if test="${requestScope.article.id == null}">
	if($.trim($("#file").val()) == '') {
		 OS.showWarming("errorTd","请选择要上传的图片！");
		 $("#file").click();
		 return false;
	}else {OS.hideWarming("errorTd");}
	</c:if>
	
	$("input:submit").attr("disabled","disabled");
	$("input:submit").attr("value","提交中...");
	//$("input:submit").removeAttr("disabled");
}
window.onload = function(){
}
$(document).ready(function(){
$("#file").change(function() { 
if($.trim($("#file").val()) != '') {OS.hideWarming("errorTd");}
}); 
$("#title").change(function() { 
if($.trim($("#title").val()) != '') {OS.hideWarming("errorTd");}
}); 
}); 
</script>
</head>
<body class="main">
<form action="editArticle.ac" method="post" enctype="multipart/form-data"  name="articleForm" id="articleForm" onSubmit="return check()" >
<input type="hidden" id="articleId" name="articleId" value="${requestScope.article.id}"/>
<input type="hidden" id="postTime" name="postTime" value="${requestScope.article.postTime}"/>
<input type="hidden" id="pic" name="pic" value="${requestScope.article.pic}"/>
<table class="container" cellpadding="0" cellspacing="0">
<tr><td>
<table width="783" height="331" align="center" cellpadding="0" cellspacing="0" class="dialog">
<tr><td width="781">
<table class="header" cellpadding="0" cellspacing="0">
<tr>
<td>
<c:choose> 
<c:when test="${null != requestScope.article.id}">编辑</c:when> 
<c:otherwise>添加</c:otherwise> 
</c:choose>讯息</td>
</tr>
</table>
</td></tr>
<tr>
  <td height="266" valign="top" class="body">
<table class="body" cellpadding="0" cellspacing="0">
<tr>
  <td colspan="2" align="center" id="errorTd">&nbsp;</td>
</tr>
  <tr>
  <td width="14%" align="right"><strong>标题：</strong></td>
  <td width="86%"><input type="text" name="title" id="title" size="75" maxlength="100" value="${requestScope.article.title}">
  </tr>
  <tr>
  <td width="14%" align="right"><strong>类别：</strong></td>
  <td width="86%"><select name="type" id="type" style="width:200px;">
  <option value="-1">==请选择==</option>
  	<c:forEach var="ARTICLE_TYPE" items="${requestScope.ARTICLE_TYPE_MAP}">
         <c:choose>
             <c:when test="${ARTICLE_TYPE.key == requestScope.article.type}">
               <option value="${ARTICLE_TYPE.key}" selected><c:out value='${ARTICLE_TYPE.value}'/></option>
              </c:when> 
           <c:otherwise>
              <option value="${ARTICLE_TYPE.key}"><c:out value='${ARTICLE_TYPE.value}'/></option>
           </c:otherwise>
         </c:choose>
    </c:forEach>
  </select> 
  
  
  </tr>
  <tr>
    <td align="right"><strong>图片：</strong></td>
    <td><label>
      <input type="file" name="file" id="file" size="40">
    </label>  
    </tr>

<tr>
  <td align="right"><strong>内容：</strong></td>
  <td>
<FCK:editor instanceName="content" value=" ${requestScope.article.content}" toolbarSet="szl" height="400" width="700" >
	<FCK:config SkinPath="skins/office2003/" />
</FCK:editor>
  </tr>
</table>
</td></tr>
<tr><td>
<table class="footer" cellpadding="0" cellspacing="0">
<tr><td>
<input class="button" type="submit" value="确定">
&nbsp;&nbsp;<input class="button" type="button" value="返回" onClick="document.location='javascript:history.go(-1)'">
</td></tr>
</table>
</td></tr>
</table>
</td></tr>
</table>
</form>

</body>
</html>
